import type { UploadUserFile } from "element-plus";

export interface GetAttrListApiParams {
  page: number;
  limit: number;
  category3Id: number;
}

// "records": [
//   {
//     "id": 3750,
//     "spuName": "weqweqw",
//     "description": "请问请问",
//     "category3Id": 1,
//     "tmId": 27,
//     "spuSaleAttrList": null,
//     "spuImageList": null
//   }
// ],
// "total": 1,
// "size": 1,
// "current": 1,
// "searchCount": true,
// "pages": 1
// },

export interface SpuItem {
  id?: number;
  spuName: string;
  description: string;
  category3Id?: number;
  tmId?: number;
}

export interface SpuSaleAttrValueItem{
  baseSAleAttrId:number;
  saleAttrValueName:string;
  id?:number;
  isChecked?:string;
  saleAttrName:string;
  spuId?:number
}

export type SpuSaleAttrValueList = SpuSaleAttrValueItem[]

export interface SpuSaleAttrItem{
  baseSaleAttrId:number;
  saleAttrName:string;
  isShowEdit:boolean;
  id?:number;
  spuId?:number;
  spuSaleAttrValueList:SpuSaleAttrValueList
}
export type SpuSaleAttrList = SpuSaleAttrItem[]

export interface SpuFormData extends SpuItem{
  spuSaleAttrList: SpuSaleAttrList;
  spuImageList: UploadUserFile[];
}

export interface SpuImageItem{
  id?:number;
  imgName:string;
  imgUrl:string;
  spuId?:number;
  isDefault?: "0" | "1";
}

export type SpuImageList = SpuImageItem[]

export interface AddOrUpdateSpuParams extends SpuItem{
  spuImageList:SpuImageList;
  spuSaleAttrList:SpuSaleAttrList
}

export type SpuList = SpuItem[];

export interface GetAttrListApiResponse {
  records: SpuList;
  total: number;
}

export interface GetSpuListApiResponse {
  records: SpuList;
  total: number;
  // size: number;
  // current: number;
  // searchCount: boolean;
  // pages: number;
}

export interface BaseSaleAttrItem {
  id: number;
  name: string;
}

export type BaseSaleAttrList = BaseSaleAttrItem[];
